import {ref,computed} from "vue"

export const useCollapse = (openCls = '',closeCls = '') => {
  const isCollapsed = ref(false);

  const handleOpen = () => {
    isCollapsed.value = false;
  }

  const handleClose = () => {
    isCollapsed.value = true;
  }

  const handleToggle = () => {
    isCollapsed.value = !isCollapsed.value;
  }

  const currentClass = computed(() => isCollapsed ? closeCls : openCls)
  return {isCollapsed,handleClose,handleOpen,currentClass,handleToggle}
}